Skip to content

优化 RuntimeService.getScriptsForTab (202606)#1511

Draft
cyfung1031 wants to merge 3 commits into
mainfrom
pr/getScriptsForTab-202606
Draft

优化 RuntimeService.getScriptsForTab (202606)#1511
cyfung1031 wants to merge 3 commits into
mainfrom
pr/getScriptsForTab-202606

Conversation

@cyfung1031

@cyfung1031 cyfung1031 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Checklist / 检查清单

  • Fixes mentioned issues / 修复已提及的问题
  • Code reviewed by human / 代码通过人工检查
  • Changes tested / 已完成测试

Description / 描述

Fable 5 没了但我刚发现我可以在ChatGPT网页版跑我写的 skill
自动化流程让 AI 重写了
我只改了几行。跑起来好像没问题。(但 lint-fix vitest 它跑不到...)
还没人工仔细看。
先本地跑一下再算

另外我发现了 删除Script后, Popup会有残留。我跟AI说要它帮我处理了

- deleteScripts now removes deleted UUIDs from all tabScript:* Popup caches, not only background tabScript:-1.
- getPopupData now filters stale cached run records through scriptDAO before appending them.
- Pending menu commands for deleted scripts are purged.
- Late GM_registerMenuCommand from deleted scripts is ignored.
- Badge counters and context menu are refreshed when deletion cleanup changes cached menu data.
- Added regression tests for stale read records, delete cleanup, and late menu register.

Screenshots / 截图

cyfung1031 and others added 3 commits June 15, 2026 15:43
- Severity: Low
- Status: Open
- Details: `getDisabledMatcher()` calls `stackAsyncTask("runtime_disabled_matcher", ...)` with a hardcoded string key. The `stacks` map in `async_queue.ts` is module-global. In production (single SW process, one RuntimeService), this is harmless. In tests that run concurrent `describe` blocks, multiple RuntimeService instances share this queue — their tasks are serialized unnecessarily. Correctness is maintained (each task closes over its own `this`), but cross-instance queue coupling is a latent fragility and harms parallel test throughput.
- Required action: Replace the hard-coded key with a per-instance unique string (e.g. `this.instanceId` set in the constructor via `crypto.randomUUID()` or a counter, used as `runtime_disabled_matcher:${this.instanceId}`).

- Severity: Low
- Status: Open
- Details: `runtime.ts` line 1151 (the JSDoc block above `buildDisabledMatcher`): "require disabledMatcherVersion **intergrity** check." is a misspelling of "integrity".
- Required action: Fix the typo.

- Severity: Note
- Status: Open
- Details: `updateSorter()` always calls `invalidateDisabledMatcher()` internally. In the `deleteScripts` listener (runtime.ts ~line 583), the explicit `this.invalidateDisabledMatcher()` before `this.updateSorter(...)` is redundant because both calls happen synchronously before any `await`. (By contrast, in `installScript` the explicit early call is necessary because `updateSorter` is deferred until after an `await scriptDAO.get()`.) The redundancy is harmless but slightly misleading about why the pattern is used.
- Required action: None strictly required. A short inline comment distinguishing the redundant-but-defensive call from the necessary early-call pattern (as in installScript) would help readers understand intent. Acceptable to leave as-is.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant